import request from '@/utils/request'

// 查询交易小票列表
export function listSaleTicket(query) {
  return request({
    url: '/pos/transaction/list',
    method: 'get',
    params: query
  })
}

// 查询交易小票详细
export function getSaleTicket(transactionId) {
  return request({
    url: '/pos/transaction/' + transactionId,
    method: 'get'
  })
}

// 根据交易流水号查询小票
export function getSaleTicketByNo(transactionNo) {
  return request({
    url: '/pos/transaction/no/' + transactionNo,
    method: 'get'
  })
}

// 查询小票明细
export function getSaleTicketDetails(transactionId) {
  return request({
    url: '/pos/transaction/details/' + transactionId,
    method: 'get'
  })
}

// 查询小票支付信息
export function getSaleTicketPays(transactionId) {
  return request({
    url: '/pos/transaction/pays/' + transactionId,
    method: 'get'
  })
}

// 验证小票（管理员校验功能）
export function validateSaleTicket(data) {
  return request({
    url: '/pos/transaction/validate',
    method: 'post',
    data: data
  })
}

// 查询退货记录
export function getRefundRecords(query) {
  return request({
    url: '/pos/transaction/refunds',
    method: 'get',
    params: query
  })
}

// 导出交易小票
export function exportSaleTicket(query) {
  return request({
    url: '/pos/transaction/export',
    method: 'post',
    data: query
  })
}
